const browser = require('../browser');
const { logger } = require('../../utils/logger');

class PuppeteerContent {
  static async getContent(url, options = {}) {
    return browser.runWithPuppeteer(url, options, async (page) => {
      const content = await page.content();
      const title = await page.title();
      
      logger.info(`Puppeteer获取内容成功: ${url}`);
      
      return {
        title,
        content,
        url,
        timestamp: new Date().toISOString()
      };
    });
  }
}

module.exports = PuppeteerContent;
